package com.rfid.config;

import com.rfid.AppNotifyImpl.MRfidReaderNotifyImpl;
import com.rfid.reader.MRfidReader;
import com.rfid.reader.RfidReader;
import com.rfid.transport.TransportThreadManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.io.IOException;

@Configuration
public class RfidConfig {

    @Bean
    @Scope("singleton")
    public TransportThreadManager transportThreadManager() throws IOException {
        TransportThreadManager.initilizeTransportManager();
        return TransportThreadManager.getInstance();
    }

    @Bean
    @Scope("singleton")
    public RfidReader rfidReader() {
        return new MRfidReader();
    }

    @Bean
    @Scope("singleton")
    public MRfidReaderNotifyImpl rfidReaderNotify() {
        return new MRfidReaderNotifyImpl();
    }
}

